<?php

class Usuario extends DBAbstractModel {

    public $placa_funcionario;
    public $password;

    function save() {
        $this->query = '';
        $this->query = "INSERT INTO usuarios (placa_funcionario,password) VALUES ";
        $this->query.="('$this->placa_funcionario', '$this->password');";
        echo "query insertar: " . $this->query . "</br>";
        $this->execute_single_query();
    }

    function delete($key) {

        $this->query = '';
        $this->query = "DELETE FROM usuarios WHERE placa_funcionario='$key'";
        echo "query eliminar: " . $this->query . "</br>";
        $this->execute_single_query();
    }

    function update($key) {
        $this->query = '';
        $this->query = "UPDATE usuarios SET placa_funcionario='$this->placa_funcionario',";
        $this->query.=" password='$this->password' WHERE placa_funcionario='$key'";

        echo "query actualizar: " . $this->query . "</br>";
        $this->execute_single_query();
    }

    function get($key) {
        if ($key != ''):
            $this->query = "SELECT *FROM usuarios WHERE placa_funcionario = '$key'";
            $this->get_results_from_query();
        endif;
    }
    function getAll() {
        $this->query = "SELECT *FROM usuarios";
        $this->get_results_from_query();
    }

}

?>